<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>表单绑定</title>
    <script src="vue.js"></script>
</head>
<body>
    <div id="div">
        <form autocomplete="off">
            姓名：<input type="text" name="username" v-model="username">
            <br>
            年龄：<input type="number" name="age" v-model="age">
            <br>
            <button @click="fun">单击改变</button>
        </form>
    </div>
</body>

<script>
    new Vue({
        el:"#div",
        data:{
            username:"张三",
            age:23
        },
        methods:{
            fun(){
                alert(this.username)
            }
        }
    });
</script>
</html>